package com.process.Imp.team;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.process.dao.team.TopicDao;
import com.process.dao.team.TopicVoDao;
import com.process.domain.team.Topic;
import com.process.domain.team.TopicVo;
import com.process.service.team.TopicService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Description:
 * @ClassName: TopicServiceImp
 * @Author: 殷凡卓
 * @Date: 2023/5/2 11:17
 */
@Service
public class TopicServiceImp extends ServiceImpl<TopicDao, Topic> implements TopicService {

    @Autowired
    private TopicDao topicDao;
    @Autowired
    private TopicVoDao topicVoDao;

    @Override
    public List<TopicVo> getInnerOrOuterPublish(String stuPhone) {

        Topic topicPriview = topicDao.getTopicPriview(stuPhone);
        if (topicPriview == null)
            return null;

        long topicType = topicPriview.getTopicType();   //  0/1/2 课程设计，校内，校外

        if (topicType == 1) {
            List<TopicVo> topicVos = topicVoDao.selectInnerTopicVoDetail(topicPriview.getPublishId());
            return topicVos;
        } else if (topicType == 2) {
            List<TopicVo> topicVos = topicVoDao.selectOuterTopicVoDetail(topicPriview.getPublishId());
            return topicVos;
        } else {
            return null;
        }


    }
}
